<!--
	作者：zhushoulong1016@163.com
	时间：2014-11-27
	描述：登录页
-->
<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>密码重置</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<script src="../../js/mui.min.js"></script>
		<script src="../../js/update.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="../../js/index.js"></script>
		<script type="text/javascript" src="../../js/jquery-1.9.1.min.js"></script>
		<script>
		
        mui.plusReady(function() { 
			
        });
                    //提交申请
        function onSub() {
	            //var self = plus.webview.currentWebview();
				//var user_id = self.user_id;//用户id
				var user_id = plus.storage.getItem('user_id');//用户id
				username
				var username = plus.storage.getItem('username');
	            var oldpassword = $("#password_y").val();
	            var newpassword = $("#rs_username").val();
	            var repassword = $("#rs_username_re").val();
	            alert(user_id);
	            alert(oldpassword);
	            if(oldpassword == ""){
	            	alert('原密码不能为空!');
	            	return ;
	            }
	            if(newpassword == ""){
	            	alert('新密码不能为空!');
	            	return ;
	            }
	            if(repassword == ""){
	            	alert('再次输入的密码不能为空!');
	            	return ;
	            }
            mui.ajax({ //ajax请求
					url: getServerIp + 'AppUser/resetPassword',
					type: 'POST',
					data: {    
                        user_id:user_id,oldpassword:oldpassword,newpassword:newpassword,repassword:repassword
					}, //传参
					success: function(data, textStatus, jqXHR) {
						alert(data.msg); 
						if(data.code == 0){
							plus.storage.setItem('userinfo',"");
							plus.storage.setItem('user_id',"");
							plus.storage.setItem('username',"");
							plus.storage.setItem('phone',"");
							plus.storage.setItem('image',"");
							mui.openWindow({ 
			                    url: '../../login.html', 
			                    id:'login'
			                });
						}else{
							return ;
						}
					}
					}); 
        }
		</script>
		
		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" href="../../css/palm.css">
		<style>
			html,
			body {
				background-color: #efeff4;
			}
			.mui-bar .mui-pull-left .mui-icon {
				padding-right: 5px;
				font-size: 28px;
			}
			.mui-bar .mui-btn {
				font-weight: normal;
				font-size: 17px;
			}
			.mui-bar .mui-btn-link {
				top: 1px;
			}
			.user_login {
				margin: 0;
				height: 10%;
				min-height: 40px;
			}
		</style>
	</head>

	<body>

		<header class="mui-bar mui-bar-nav">
			<button class="mui-action-back mui-btn mui-btn-blue mui-btn-link mui-btn-nav mui-pull-left">
				<span class="mui-icon mui-icon-left-nav" style="float: left;height: 40px;line-height: 40px;"></span>
				<img src="../../images/logo.png"  style=" height: 40px;"/>
			</button>
			<h1 class="mui-title">重设密码</h1>
		</header>
        <form class='queryform' id='loginform' style="top: 45px;">
        <div style="border: 1px solid #83E5AB;margin: 0 10%;padding: 10px;margin-bottom: 40px;background: #fff;">
        	<div class="user_login">
        		<input id="password_y" style="border-bottom: 1px solid #9a9a9a;" type="password" placeholder="请输入原密码"/>
        	</div>
        	<div class="user_login">
        		<input id="rs_username" style="border-bottom: 1px solid #9a9a9a;" type="password" placeholder="请设置新密码"/>
        	</div>
        	<div class="user_login">
        		<input id="rs_username_re" style="border-bottom: 1px solid #9a9a9a;" type="password" placeholder="请确认新密码"/>
        	</div>
        </div>
        
        <div onclick="onSub();" class='button'>设&nbsp&nbsp&nbsp&nbsp置</div>
	
        </form>
        
    </body>

</html>
